/**
 * 
 * 起迪科技 Copyright (c) 2014-2018 QiDi,Inc.All Rights Reserved.
 */

package cn.qidisoft.edu.hzjt.controller.twglstudentcadre;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import cn.qidisoft.core.common.context.ApplicationContextConfigUtil;
import cn.qidisoft.core.common.log.LoggerAdapter;
import cn.qidisoft.core.common.log.LoggerAdapterFactory;
import cn.qidisoft.core.common.pagination.Page;
import cn.qidisoft.core.common.pagination.PaginationBean;
import cn.qidisoft.core.util.file.FileUtil;
import cn.qidisoft.core.util.moffice.excel.ExpExcelUtil;
import cn.qidisoft.edu.hzjt.annotation.SysLogger;
import cn.qidisoft.edu.hzjt.constants.Constant;
import cn.qidisoft.edu.hzjt.controller.BaseController;
import cn.qidisoft.edu.hzjt.exception.RPCException;
import cn.qidisoft.edu.hzjt.model.BjxxClassMaterialFile;
import cn.qidisoft.edu.hzjt.model.Employee;
import cn.qidisoft.edu.hzjt.model.ResponseResult;
import cn.qidisoft.edu.hzjt.model.Student;
import cn.qidisoft.edu.hzjt.model.StudentClass;
import cn.qidisoft.edu.hzjt.model.TwglStudentCadre;
import cn.qidisoft.edu.hzjt.model.TwglStudentCadreAtt;
import cn.qidisoft.edu.hzjt.model.UserEmployee;
import cn.qidisoft.edu.hzjt.service.ICommonService;
import cn.qidisoft.edu.hzjt.service.ITwglStudentCadreAttService;
import cn.qidisoft.edu.hzjt.service.ITwglStudentCadreService;
import cn.qidisoft.edu.hzjt.utils.LogType;

/**
 * 
 * 
 * @author Administrator
 * @version $Id: TwglStudentCadreController.java, v 0.1 2018年11月1日 上午10:50:34 hhl Exp $
 */

@Controller
@RequestMapping(value = "twglStudentCadre")
public class TwglStudentCadreController {
    protected static final LoggerAdapter                  LOGGER = LoggerAdapterFactory
        .getLogger(LogType.HZJT_LOGGER.val);
    @Autowired
    private ITwglStudentCadreService                      twglStudentCadreService;

    @Autowired
    private ITwglStudentCadreAttService                   twglStudentCadreAttService;

    @Autowired
    private ICommonService                                commonService;

    private static Map<String, List<TwglStudentCadreAtt>> picMap = new HashMap<String, List<TwglStudentCadreAtt>>();

    private static String                                 upload = null;

    static {
        upload = ApplicationContextConfigUtil.getString("file.path", null);
    }

    @RequestMapping(value = "/index")
    public String index(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            picMap.remove(String.valueOf(userEmployee.getUserid()));

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");

            // 获得年级信息
            BaseController.getGradeList(model, commonService);
            // 获得专业
            BaseController.getSpecialityList(model, commonService);
            Student student = new Student();
            List<StudentClass> classList = commonService.queryGradeSpecialtyByClass(student);
            model.put("classList", classList);
        } catch (Exception e) {
            e.printStackTrace();
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }

        return "twglStudentCadre/twglStudentCadreList";
    }

    @RequestMapping(value = "/List")
    @ResponseBody
    public ResponseResult List(ModelMap model, HttpServletRequest request,
                               @RequestParam(value = "rows", required = false) String pageSize,
                               @RequestParam(value = "page", required = false) String currentPage,
                               TwglStudentCadre data) {

        try {
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");

            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            data.setCadretype(1);

            PaginationBean<TwglStudentCadre> paginationBean = twglStudentCadreService
                .queryPageList(data, page);
            ResponseResult result = new ResponseResult();
            if (paginationBean.getPageList().isEmpty()) {
                result.setRows(new ArrayList<TwglStudentCadre>());
            } else {
                result.setRows(paginationBean.getPageList());
            }
            result.setTotal(paginationBean.getTotalRecords());

            return result;
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }

    @RequestMapping(value = "/addInInt", method = RequestMethod.GET)
    public String add(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            picMap.remove(String.valueOf(userEmployee.getUserid()));

            List<Student> studentList = commonService
                .queryClassOrGradeByStudent(new StudentClass());
            model.put("studentList", studentList);
            model.put("studentListJson", JSON.toJSONString(studentList));

            // 老师登入系统不包括自己
            Employee employee = new Employee();
            if (userEmployee.getEmid() != null) {
                Integer emid[] = { userEmployee.getEmid() };
                employee.setEmpids(emid);
            }
            java.util.List<Employee> EmployeeList = commonService
                .queryNotCurrByAllEmployee(employee);
            model.addAttribute("EmployeeList", EmployeeList);

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");
        } catch (Exception e) {
            e.printStackTrace();
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return "twglStudentCadre/add_TwglStudentCadre";
    }

    @RequestMapping(value = "/details", method = RequestMethod.GET)
    public String details(ModelMap model, HttpServletRequest request,
                          @RequestParam(value = "id", required = false) Integer id,
                          @RequestParam(value = "gid", required = false) String gid) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            picMap.remove(String.valueOf(userEmployee.getUserid()));

            TwglStudentCadre data = new TwglStudentCadre();
            data.setGbid(id);
            data.setGid(gid);
            data.setCadretype(1);
            data = twglStudentCadreService.queryByPK(data);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

            if (data.getKsrq() != null) {
                data.setKsrq1(sdf.format(data.getKsrq()));
            }

            TwglStudentCadreAtt data1 = new TwglStudentCadreAtt();
            data1.setParentid(Integer.valueOf(id));
            List<TwglStudentCadreAtt> dataList = twglStudentCadreAttService.queryList(data1);
            model.addAttribute("dataList", dataList);

            model.addAttribute("data", data);
            return "twglStudentCadre/details_TwglStudentCadre";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "新增保存")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public String add(ModelMap model, HttpServletRequest request, TwglStudentCadre data) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            if (data.getKsrq1().equals("")) {
            } else {
                data.setKsrq(sdf.parse(data.getKsrq1()));
            }
            if (data.getDrzw() == null || data.getDrzw().equals("")) {
                data.setDrzw("");
            }
            data.setCreatorid(userEmployee.getUid());
            data.setCreatetime(new Date());
            data.setCreatorname(userEmployee.getUserid());
            data.setCadretype(1);
            String gid = twglStudentCadreService.add(data);

            TwglStudentCadre data1 = new TwglStudentCadre();
            data1.setGid(gid);
            data1 = twglStudentCadreService.queryByPK(data);

            List<TwglStudentCadreAtt> docFileResourceList = picMap
                .get(String.valueOf(userEmployee.getUserid()));
            if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
                MultipartFile file = null;
                Integer orders = 0;
                for (TwglStudentCadreAtt r : docFileResourceList) {
                    file = r.getMufile();
                    String name = file.getOriginalFilename();// 获取上传文件名
                    InputStream in = r.getInputStream();// 获取文件对象
                    int pos = name.lastIndexOf(".");
                    String lastname = name.substring(pos, name.length());
                    // 文件保存的路径
                    String savePath = upload + File.separator + r.getGid();
                    FileUtil.saveFile(savePath, in, r.getGid() + lastname);
                    r.setParentid(data1.getGbid());
                    r.setGid(r.getGid());// 附件id
                    r.setFilename(name);
                    r.setOrders(orders);
                    twglStudentCadreAttService.add(r);
                    orders++;
                }
            }
            model.addAttribute("id", data1.getGbid());
            return "redirect:/twglStudentCadre/details";
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "提交")
    @RequestMapping(value = "/btnSubmit")
    public String btnSubmit(ModelMap model, HttpServletRequest request,
                            @RequestParam(value = "id", required = false) Integer id) {
        try {

            TwglStudentCadre data = new TwglStudentCadre();
            data.setGbid(id);
            data.setCadretype(1);
            data = twglStudentCadreService.queryByPK(data);

            data.setStates(1);
            twglStudentCadreService.update(data);
            model.addAttribute("id", id);
            return "redirect:/twglStudentCadre/details";
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "提交")
    @RequestMapping(value = "/updatebtnSubmit")
    public String updatebtnSubmit(ModelMap model, HttpServletRequest request,
                                  TwglStudentCadre data) {
        try {

            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            if (data.getKsrq1().equals("")) {
            } else {
                data.setKsrq(sdf.parse(data.getKsrq1()));
            }
            if (data.getDrzw() == null || data.getDrzw().equals("")) {
                data.setDrzw("");
            }
            data.setCreatorid(userEmployee.getUid());
            data.setCreatetime(new Date());
            data.setCreatorname(userEmployee.getUserid());
            data.setCadretype(1);
            data.setStates(1);
            twglStudentCadreService.update(data);

            List<TwglStudentCadreAtt> docFileResourceList = picMap
                .get(String.valueOf(userEmployee.getUserid()));
            if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
                MultipartFile file = null;
                Integer orders = 0;
                for (TwglStudentCadreAtt r : docFileResourceList) {
                    file = r.getMufile();
                    String name = file.getOriginalFilename();// 获取上传文件名
                    InputStream in = r.getInputStream();// 获取文件对象
                    int pos = name.lastIndexOf(".");
                    String lastname = name.substring(pos, name.length());
                    // 文件保存的路径
                    String savePath = upload + File.separator + r.getGid();
                    FileUtil.saveFile(savePath, in, r.getGid() + lastname);
                    r.setParentid(data.getGbid());
                    r.setGid(r.getGid());// 附件id
                    r.setFilename(name);
                    r.setOrders(orders);
                    twglStudentCadreAttService.add(r);
                    orders++;
                }
            }
            model.addAttribute("id", data.getGbid());
            return "redirect:/twglStudentCadre/details";
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @RequestMapping(value = "/updateToview", method = RequestMethod.GET)
    public String updateToview(ModelMap model, HttpServletRequest request,
                               @RequestParam(value = "id") Integer id) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            picMap.remove(String.valueOf(userEmployee.getUserid()));

            TwglStudentCadre data = new TwglStudentCadre();
            data.setGbid(id);
            data.setCadretype(1);
            data = twglStudentCadreService.queryByPK(data);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

            if (data.getKsrq() != null) {
                data.setKsrq1(sdf.format(data.getKsrq()));
            }
            TwglStudentCadreAtt data1 = new TwglStudentCadreAtt();
            data1.setParentid(Integer.valueOf(id));
            List<TwglStudentCadreAtt> dataList = twglStudentCadreAttService.queryList(data1);
            model.addAttribute("dataList", dataList);
            model.addAttribute("data", data);

            List<Student> studentList = commonService
                .queryClassOrGradeByStudent(new StudentClass());
            model.put("studentList", studentList);
            model.put("studentListJson", JSON.toJSONString(studentList));

            // 老师登入系统不包括自己
            Employee employee = new Employee();
            if (userEmployee.getEmid() != null) {
                Integer emid[] = { userEmployee.getEmid() };
                employee.setEmpids(emid);
            }
            java.util.List<Employee> EmployeeList = commonService
                .queryNotCurrByAllEmployee(employee);
            model.addAttribute("EmployeeList", EmployeeList);

            return "twglStudentCadre/update_TwglStudentCadre";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "新增保存")
    @RequestMapping(value = "/addSaveContinue", method = RequestMethod.POST)
    public String addSaveContinue(ModelMap model, HttpServletRequest request,
                                  TwglStudentCadre data) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            if (data.getKsrq1().equals("")) {
            } else {
                data.setKsrq(sdf.parse(data.getKsrq1()));
            }
            if (data.getDrzw() == null || data.getDrzw().equals("")) {
                data.setDrzw("");
            }
            data.setCreatorid(userEmployee.getUid());
            data.setCreatetime(new Date());
            data.setCreatorname(userEmployee.getUserid());
            data.setCadretype(1);
            String gid = twglStudentCadreService.add(data);

            TwglStudentCadre data1 = new TwglStudentCadre();
            data1.setGid(gid);
            data1 = twglStudentCadreService.queryByPK(data);

            List<TwglStudentCadreAtt> docFileResourceList = picMap
                .get(String.valueOf(userEmployee.getUserid()));
            if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
                MultipartFile file = null;
                Integer orders = 0;
                for (TwglStudentCadreAtt r : docFileResourceList) {
                    file = r.getMufile();
                    String name = file.getOriginalFilename();// 获取上传文件名
                    InputStream in = r.getInputStream();// 获取文件对象
                    int pos = name.lastIndexOf(".");
                    String lastname = name.substring(pos, name.length());
                    // 文件保存的路径
                    String savePath = upload + File.separator + r.getGid();
                    FileUtil.saveFile(savePath, in, r.getGid() + lastname);
                    r.setParentid(data1.getGbid());
                    r.setGid(r.getGid());// 附件id
                    r.setFilename(name);
                    r.setOrders(orders);
                    twglStudentCadreAttService.add(r);
                    orders++;
                }
            }
            BaseController.setParameter("msg", "添加成功");

            return "redirect:addInInt";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("添加信息 add [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "修改")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public String update(ModelMap model, HttpServletRequest request, TwglStudentCadre data) {
        try {

            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            if (data.getKsrq1().equals("")) {
            } else {
                data.setKsrq(sdf.parse(data.getKsrq1()));
            }
            if (data.getDrzw() == null || data.getDrzw().equals("")) {
                data.setDrzw("");
            }
            data.setCreatorid(userEmployee.getUid());
            data.setCreatetime(new Date());
            data.setCreatorname(userEmployee.getUserid());
            data.setCadretype(1);
            twglStudentCadreService.update(data);

            List<TwglStudentCadreAtt> docFileResourceList = picMap
                .get(String.valueOf(userEmployee.getUserid()));
            if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
                MultipartFile file = null;
                Integer orders = 0;
                for (TwglStudentCadreAtt r : docFileResourceList) {
                    file = r.getMufile();
                    String name = file.getOriginalFilename();// 获取上传文件名
                    InputStream in = r.getInputStream();// 获取文件对象
                    int pos = name.lastIndexOf(".");
                    String lastname = name.substring(pos, name.length());
                    // 文件保存的路径
                    String savePath = upload + File.separator + r.getGid();
                    FileUtil.saveFile(savePath, in, r.getGid() + lastname);
                    r.setParentid(data.getGbid());
                    r.setGid(r.getGid());// 附件id
                    r.setFilename(name);
                    r.setOrders(orders);
                    twglStudentCadreAttService.add(r);
                    orders++;
                }
            }
            return "redirect:index";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("查询 update [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "删除")
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public String delete(ModelMap model, HttpServletRequest request) {
        try {
            String[] idList = request.getParameter("idList").split(",");
            TwglStudentCadre data = new TwglStudentCadre();
            data.setIds(idList);
            twglStudentCadreService.delete(data);
            BaseController.setParameter("msg", "删除成功");
            return "redirect:index";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("删除 delete [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    /**
     * 上传附件
     * 
     * @param file
     * @param request
     * @param response
     */
    @RequestMapping(value = "/source_upload", method = RequestMethod.POST)
    public @ResponseBody void loadFile(@RequestParam("file") MultipartFile file,
                                       HttpServletRequest request, HttpServletResponse response) {

        List<TwglStudentCadreAtt> list = new ArrayList<TwglStudentCadreAtt>();
        UserEmployee userEmployee = (UserEmployee) request.getSession()
            .getAttribute(Constant.LOGIN_CONSOLE_USER);
        List<TwglStudentCadreAtt> docFileResourceList = picMap
            .get(String.valueOf(userEmployee.getUserid()));
        // 本地env配置路径
        String path = upload;
        TwglStudentCadreAtt docFile = new TwglStudentCadreAtt();
        if (!file.isEmpty()) {
            // 文件的大小
            docFile
                .setFilesize(String.valueOf(FileUtil.FormetFileSize(Long.valueOf(file.getSize()))));

            String name = file.getOriginalFilename();// 获取上传文件名
            docFile.setFilename(name);
            String gid = UUID.randomUUID().toString();
            // 获取文件后缀名称
            String extend = FilenameUtils.getExtension(name);
            // 文件路径带后缀
            docFile.setFilepath(gid + "/" + gid + "." + extend);
            // 全路径系统文件名称带点
            docFile
                .setSysfilepath(path + File.separator + gid + File.separator + gid + "." + extend);
            // 文件名称uuid
            docFile.setFilename(gid);
            // 上传时间
            /* docFile.setMsubmittime(new Date()); */
            //获取文件扩展名
            docFile.setExtension(FileUtil.getFileExtendName(name).toLowerCase());
            //获取文件类型
            docFile.setContenttype(FileUtil.getFileExtendName(name).toLowerCase());
            docFile
                .setFilesize(String.valueOf(FileUtil.FormetFileSize(Long.valueOf(file.getSize()))));// 获取文件大小
            // uuid
            docFile.setGid(gid);

            docFile.setMufile(file);
            try {
                docFile.setInputStream(file.getInputStream());
            } catch (IOException e) {
            }

            if (docFileResourceList != null && docFileResourceList.size() > 0) {
                docFileResourceList.add(docFile);
                picMap.put(String.valueOf(userEmployee.getUserid()), docFileResourceList);
            } else {
                list.add(docFile);
                picMap.put(String.valueOf(userEmployee.getUserid()), list);
            }
            LOGGER.info("附件上传成功！");
        }
        PrintWriter writer = null;
        try {

            BjxxClassMaterialFile docFile2 = new BjxxClassMaterialFile();
            docFile2.setFilepath(docFile.getFilepath());
            // 文件名称
            docFile2.setFilename(docFile.getFilename());
            docFile2.setSysfilepath(docFile.getSysfilepath());

            writer = (PrintWriter) response.getWriter();
            String json = JSONObject.toJSONString(docFile2);
            writer.write(json);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 新增删除服务器的文件
     * 
     * @param request
     * @return
     */
    @RequestMapping(value = "/deletefile", method = RequestMethod.POST)
    public @ResponseBody Map<String, Object> deleteFile(HttpServletRequest request) {

        Map<String, Object> dataMap = new HashMap<String, Object>();
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);

            // env配置路径
            String path = upload;

            String filepath = request.getParameter("filepath");
            LOGGER.info("文件的原始路径===" + filepath);
            // 文件的全路径
            String fullpath = null;
            // 文件名称
            String filename = null;
            // 文件名无后缀
            String fileNoSuffix = null;

            if (filepath.indexOf("prefix") == -1) {
                // 文件的文件名称
                fileNoSuffix = filepath.split(",")[0];
                String sec = filepath.split(",")[1];
                // 文件的后缀
                String suffix = sec.substring(sec.indexOf("."));
                // 文件名无后缀加上后缀
                filename = fileNoSuffix + suffix;
                // 文件的全路径
                fullpath = path + "/" + fileNoSuffix;
                // FileUtil.deleteFile(fullpath, filename);//删除文件目录下面的文件
                // FileUtils.forceDelete(new File(fullpath)); //删除文件目录
            } else {
                return dataMap;
            }

            List<TwglStudentCadreAtt> noticeNewsFilepathList = picMap
                .get(String.valueOf(userEmployee.getUserid()));

            // 删除list里面前台删除的前台信息图片附件表
            if (noticeNewsFilepathList != null && !noticeNewsFilepathList.isEmpty()) {
                for (TwglStudentCadreAtt noticenewsfilepath : noticeNewsFilepathList) {
                    if (noticenewsfilepath.getFilename().equals(fileNoSuffix)) {
                        noticeNewsFilepathList.remove(noticenewsfilepath);
                        break;
                    }
                }
            }
            // 先删除
            picMap.remove(userEmployee.getUserid());
            // 后添加
            picMap.put(String.valueOf(userEmployee.getUserid()), noticeNewsFilepathList);
            dataMap.put("success", "0000");
            return dataMap;
        } catch (Exception e) {
            dataMap.put("success", "-9999");
            return dataMap;
        }
    }

    /**
     * 修改删除图片
     * 
     * @param file
     * @param request
     * @param response
     */
    @RequestMapping(value = "/source_upload_update", method = RequestMethod.POST)
    public @ResponseBody Map<String, Object> source_upload_update(@RequestParam("id") String id,
                                                                  HttpServletRequest request,
                                                                  HttpServletResponse response) {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        try {
            TwglStudentCadreAtt data = new TwglStudentCadreAtt();
            data.setGid(id);
            twglStudentCadreAttService.delete(data);
            File file = new File(upload + File.separator + id);
            if (file.isDirectory()) {// 判断file是否是文件目录 若是返回TRUE
                String name[] = file.list();// name存储file文件夹中的文件名
                for (int i = 0; i < name.length; i++) {
                    File f = new File(upload + File.separator + id, name[i]);// 此时就可得到文件夹中的文件
                    f.delete();// 删除文件
                }
                FileUtils.forceDelete(new File(upload + File.separator + id)); // 最后删除文件目录
            }
            dataMap.put("success", "0000");
        } catch (Exception e) {
            LOGGER.error("调用services网络异常", e);
            dataMap.put("success", "-9999");
        }
        return dataMap;
    }

    /**
     * 下载
     * 
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/export")
    public @ResponseBody String export(HttpServletRequest request, HttpServletResponse response,
                                       TwglStudentCadre data,
                                       @RequestParam("bodyData") String bodyData,
                                       ModelMap model) throws Exception {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

            BaseController.setSortByColumn(request, "createtime", "desc");
            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            data.setCadretype(1);
            List<TwglStudentCadre> datalist = twglStudentCadreService.export(data);

            String[][] title_name = { { "状态", "姓名", "学号", "班级", "专业", "年级", "职务", "任职开始时间", "任职年限",
                                        "创建时间" } };
            String[] title_style = { "hwzs_16_bold_25", "kt_12_bold_18", "st_12_r_20", "st_12_n_20",
                                     "st_12_n_20", "st_12_n_20" };
            String fileName = "学生干部管理信息";
            String[] remark = { "" };
            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
            /*  List<TwglStudentCadre> datalist = JSONArray.parseArray(bodyData,
                TwglStudentCadre.class);*/
            if (datalist != null && !datalist.isEmpty()) {
                for (TwglStudentCadre r : datalist) {
                    Map<String, Object> map = new LinkedHashMap<String, Object>();
                    if (r.getStates() == 1) {
                        map.put("states", "审核中");
                    } else if (r.getStates() == 0) {
                        map.put("states", "未提交");
                    } else if (r.getStates() == 2) {
                        map.put("states", "审核通过");
                    } else if (r.getStates() == 3) {
                        map.put("states", "审核退回");
                    }
                    map.put("xm", r.getXm());
                    map.put("xh", r.getXh());
                    map.put("bj", r.getBjmc());
                    map.put("zy", r.getZymc());
                    map.put("njmc", r.getNjmc());
                    if (r.getDrzw() == null || r.getDrzw().equals("")) {
                        map.put("drzw", null);
                    } else {
                        map.put("drzw", r.getDrzw());
                    }
                    if (r.getKsrq() == null) {
                        map.put("ksrq", null);
                    } else {
                        map.put("ksrq", sdf.format(r.getKsrq()));
                    }
                    map.put("rznx", r.getRznx());
                    map.put("cjsj", sdf.format(r.getCreatetime()));
                    list.add(map);
                }
            }
            HSSFWorkbook wb = ExpExcelUtil.getWorkBookExcel(title_name, title_style, 100, remark,
                fileName, list);
            try {
                String filenameConvert = "学生干部管理信息";/* new String(fileName.getBytes("GB2312"), "ISO8859-1"); */
                response.reset();
                response.setContentType("application/vnd.ms-excel;charset=utf-8");
                response.setHeader("Content-Disposition",
                    "attachment;filename=" + new String((filenameConvert + ".xls").getBytes(),
                        "iso-8859-1"));
                response.setDateHeader("Expires", 0);
                ServletOutputStream os = response.getOutputStream();
                wb.write(os);
                os.flush();
            } catch (Exception e) {
                System.out.println("网络连接断开，可能用户取消了导出");
                model.addAttribute(Constant.EXPTION_MSG_KEY, e);
                return "error/error";
            }
        } catch (RPCException e) {
            LOGGER.error("获得信息 export[{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return null;
    }

    /**
     * 管理端
     * 
     * @param model
     * @param request
     * @return
     */
    @RequestMapping(value = "/index_admin")
    public String index_admin(ModelMap model, HttpServletRequest request) {
        try {
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            picMap.remove(String.valueOf(userEmployee.getUserid()));

            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");

            // 获得年级信息
            BaseController.getGradeList(model, commonService);
            // 获得专业
            BaseController.getSpecialityList(model, commonService);
            Student student = new Student();
            // 获得班级
            List<StudentClass> classList = commonService.queryGradeSpecialtyByClass(student);
            model.put("classList", classList);
        } catch (Exception e) {
            e.printStackTrace();
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }

        return "twglStudentCadre/twglStudentCadreList_admin";
    }

    @RequestMapping(value = "/List_admin")
    @ResponseBody
    public ResponseResult List_admin(ModelMap model, HttpServletRequest request,
                                     @RequestParam(value = "rows", required = false) String pageSize,
                                     @RequestParam(value = "page", required = false) String currentPage,
                                     TwglStudentCadre data) {

        try {
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");
            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            data.setLogo(100); // 标识管理端
            data.setCadretype(1);
            PaginationBean<TwglStudentCadre> paginationBean = twglStudentCadreService
                .queryPageList(data, page);
            ResponseResult result = new ResponseResult();

            if (paginationBean.getPageList().isEmpty()) {
                result.setRows(new ArrayList<TwglStudentCadre>());
            } else {
                result.setRows(paginationBean.getPageList());
            }
            result.setTotal(paginationBean.getTotalRecords());
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }

    /**
     * 管理端下载
     * 
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/export_admin")
    public @ResponseBody String export_admin(HttpServletRequest request,
                                             HttpServletResponse response, TwglStudentCadre data,
                                             @RequestParam("bodyData") String bodyData,
                                             ModelMap model) throws Exception {
        try {

            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            BaseController.setSortByColumn(request, "createtime", "desc");
            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            data.setLogo(100); // 标识管理端
            data.setCadretype(1);
            List<TwglStudentCadre> datalist = twglStudentCadreService.export(data);

            String[][] title_name = { { "姓名", "学号", "班级", "专业", "年级", "职务", "任职开始时间", "任职年限" } };
            String[] title_style = { "hwzs_16_bold_25", "kt_12_bold_18", "st_12_r_20", "st_12_n_20",
                                     "st_12_n_20", "st_12_n_20", "st_12_n_20" };
            String fileName = "学生干部管理信息";
            String[] remark = { "" };
            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
            /*List<TwglStudentCadre> datalist = JSONArray.parseArray(bodyData,
                TwglStudentCadre.class);*/
            if (datalist != null && !datalist.isEmpty()) {
                for (TwglStudentCadre r : datalist) {
                    Map<String, Object> map = new LinkedHashMap<String, Object>();
                    map.put("xm", r.getXm());
                    map.put("xh", r.getXh());
                    map.put("bj", r.getBjmc());
                    map.put("zy", r.getZymc());
                    map.put("njmc", r.getNjmc());
                    if (r.getDrzw() == null || r.getDrzw().equals("")) {
                        map.put("drzw", null);
                    } else {
                        map.put("drzw", r.getDrzw());
                    }
                    if (r.getKsrq() == null) {
                        map.put("ksrq", null);
                    } else {
                        map.put("ksrq", sdf.format(r.getKsrq()));
                    }
                    map.put("rznx", r.getRznx());
                    list.add(map);
                }
            }
            HSSFWorkbook wb = ExpExcelUtil.getWorkBookExcel(title_name, title_style, 100, remark,
                fileName, list);
            try {
                String filenameConvert = "学生干部管理信息";/* new String(fileName.getBytes("GB2312"), "ISO8859-1"); */
                response.reset();
                response.setContentType("application/vnd.ms-excel;charset=utf-8");
                response.setHeader("Content-Disposition",
                    "attachment;filename=" + new String((filenameConvert + ".xls").getBytes(),
                        "iso-8859-1"));
                response.setDateHeader("Expires", 0);
                ServletOutputStream os = response.getOutputStream();
                wb.write(os);
                os.flush();
            } catch (Exception e) {
                System.out.println("网络连接断开，可能用户取消了导出");
                model.addAttribute(Constant.EXPTION_MSG_KEY, e);
                return "error/error";
            }
        } catch (RPCException e) {
            LOGGER.error("获得信息 export[{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return null;
    }

    /**
     * 审核端
     * 
     * @param model
     * @param request
     * @return
     */
    @RequestMapping(value = "/index_audit")
    public String index_audit(ModelMap model, HttpServletRequest request) {
        try {
            request.setAttribute("msg", BaseController.getParameter("msg"));
            BaseController.removeParameter("msg");
            model.addAttribute("states", 1);
            // 获得年级信息
            BaseController.getGradeList(model, commonService);
            // 获得专业
            BaseController.getSpecialityList(model, commonService);
            Student student = new Student();
            // 获得班级
            List<StudentClass> classList = commonService.queryGradeSpecialtyByClass(student);
            model.put("classList", classList);
        } catch (Exception e) {
            e.printStackTrace();
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }

        return "twglStudentCadre/twglStudentCadreList_audit";
    }

    @RequestMapping(value = "/List_audit")
    @ResponseBody
    public ResponseResult List_audit(ModelMap model, HttpServletRequest request,
                                     @RequestParam(value = "rows", required = false) String pageSize,
                                     @RequestParam(value = "page", required = false) String currentPage,
                                     TwglStudentCadre data) {

        Integer type = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
        if (type == 1) {// 学生
            Student student = (Student) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            data.setAuditortype(2);
            data.setAuditorid(student.getXsid());
        }
        if (type == 2) {// 老师
            UserEmployee userEmployee = (UserEmployee) request.getSession()
                .getAttribute(Constant.LOGIN_CONSOLE_USER);
            data.setAuditortype(1);
            data.setAuditorid(userEmployee.getEmid());
        }

        if (data.getStates() == null) {
            data.setStates(1);
            data.setLogo(99); // 标识管理端
        } else if (data.getStates() == -1) {
            data.setLogo(99); // 标识管理端
            data.setStates(null); // 标识管理端
        }
        data.setCadretype(1);
        try {
            Page page = new Page();
            page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
            page.setPageSize(pageSize == null ? Constant.PageSize : Integer.valueOf(pageSize));
            BaseController.setSortByColumn(request, "createtime", "desc");
            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            PaginationBean<TwglStudentCadre> paginationBean = twglStudentCadreService
                .queryPageList(data, page);
            ResponseResult result = new ResponseResult();
            if (paginationBean.getPageList().isEmpty()) {
                result.setRows(new ArrayList<TwglStudentCadre>());
            } else {
                result.setRows(paginationBean.getPageList());
            }
            result.setTotal(paginationBean.getTotalRecords());
            return result;
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }

    @RequestMapping(value = "/details_audit", method = RequestMethod.GET)
    public String details_admin(ModelMap model, HttpServletRequest request,
                                @RequestParam(value = "id", required = false) Integer id,
                                @RequestParam(value = "gid", required = false) String gid) {
        try {

            TwglStudentCadre data = new TwglStudentCadre();
            data.setGbid(id);
            data.setGid(gid);
            data.setCadretype(1);
            data = twglStudentCadreService.queryByPK(data);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

            if (data.getKsrq() != null) {
                data.setKsrq1(sdf.format(data.getKsrq()));
            }

            TwglStudentCadreAtt data1 = new TwglStudentCadreAtt();
            data1.setParentid(Integer.valueOf(id));
            List<TwglStudentCadreAtt> dataList = twglStudentCadreAttService.queryList(data1);
            model.addAttribute("dataList", dataList);
            model.addAttribute("data", data);

            return "twglStudentCadre/details_TwglStudentCadre_audit";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("查询 queryByPK [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "审核通过")
    @RequestMapping(value = "/audit")
    public String audit(ModelMap model, HttpServletRequest request, TwglStudentCadre data,
                        @RequestParam(value = "states", required = false) String states) {
        try {

            String auditresult = data.getAuditSuggestion();
            data.setCadretype(1);
            data = twglStudentCadreService.queryByPK(data);

            /*
             * if (type == 1) {//学生 Student student = (Student) request.getSession()
             * .getAttribute(Constant.LOGIN_CONSOLE_USER); data.setAuditorname(student.getXm()); } if
             * (type == 2) {//老师 UserEmployee userEmployee = (UserEmployee) request.getSession()
             * .getAttribute(Constant.LOGIN_CONSOLE_USER); data.setAuditorname(userEmployee.getXm()); }
             */
            data.setStates(Integer.valueOf(states));
            data.setAuditTime(new Date());
            data.setAuditSuggestion(auditresult);
            twglStudentCadreService.update(data);

            return "redirect:index_audit";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("审核 update [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    @SysLogger(description = "学生干部管理信息", moduleName = "学生干部管理", method = "审核")
    @RequestMapping(value = "/auditList")
    public String auditList(ModelMap model, HttpServletRequest request) {
        try {

            String[] idList = request.getParameter("idList").split(",");
            String states = request.getParameter("states1");

            TwglStudentCadre data = new TwglStudentCadre();
            data.setIds(idList);
            data.setStates(Integer.valueOf(states));
            /*
             * Integer type = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE); if
             * (type == 1) {//学生 Student student = (Student) request.getSession()
             * .getAttribute(Constant.LOGIN_CONSOLE_USER); data.setAuditorname(student.getXm()); } if
             * (type == 2) {//老师 UserEmployee userEmployee = (UserEmployee) request.getSession()
             * .getAttribute(Constant.LOGIN_CONSOLE_USER); data.setAuditorname(userEmployee.getXm()); }
             */

            data.setAuditTime(new Date());
            twglStudentCadreService.auditList(data);
            BaseController.setParameter("msg", "审核成功");
            return "redirect:index_audit";
        } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("审核 delete [{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
    }

    /**
     * 审核下载
     * 
     * @param form
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/export_audit")
    public @ResponseBody String export_audit(HttpServletRequest request,
                                             HttpServletResponse response, TwglStudentCadre data,
                                             @RequestParam("bodyData") String bodyData,
                                             ModelMap model) throws Exception {
        try {

            Integer type = (Integer) request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
            if (type == 1) {// 学生
                Student student = (Student) request.getSession()
                    .getAttribute(Constant.LOGIN_CONSOLE_USER);
                data.setAuditortype(2);
                data.setAuditorid(student.getXsid());
            }
            if (type == 2) {// 老师
                UserEmployee userEmployee = (UserEmployee) request.getSession()
                    .getAttribute(Constant.LOGIN_CONSOLE_USER);
                data.setAuditortype(1);
                data.setAuditorid(userEmployee.getEmid());
            }

            if (data.getStates() == null) {
                data.setStates(1);
                data.setLogo(99); // 标识管理端
            } else if (data.getStates() == -1) {
                data.setLogo(99); // 标识管理端
                data.setStates(null); // 标识管理端
            }
            data.setCadretype(1);
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            BaseController.setSortByColumn(request, "createtime", "desc");
            if (request.getAttribute("orderField").equals("drzw")) {
                data.setOrderField("dre.drzw");
            } else {
                data.setOrderField((String) request.getAttribute("orderField"));
            }
            data.setOrderFlag((String) request.getAttribute("orderFlag"));
            List<TwglStudentCadre> datalist = twglStudentCadreService.export(data);

            String[][] title_name = { { "状态", "姓名", "学号", "班级", "专业", "年级", "职务", "任职开始时间", "任职年限",
                                        "创始人", "创建时间" } };
            String[] title_style = { "hwzs_16_bold_25", "kt_12_bold_18", "st_12_r_20", "st_12_n_20",
                                     "st_12_n_20", "st_12_n_20" };
            String fileName = "学生干部管理信息";
            String[] remark = { "" };
            List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
            /*  List<TwglStudentCadre> datalist = JSONArray.parseArray(bodyData,
                TwglStudentCadre.class);*/
            if (datalist != null && !datalist.isEmpty()) {
                for (TwglStudentCadre r : datalist) {
                    Map<String, Object> map = new LinkedHashMap<String, Object>();
                    if (r.getStates() == 1) {
                        map.put("states", "审核中");
                    } else if (r.getStates() == 0) {
                        map.put("states", "未提交");
                    } else if (r.getStates() == 2) {
                        map.put("states", "审核通过");
                    } else if (r.getStates() == 3) {
                        map.put("states", "审核退回");
                    }
                    map.put("xm", r.getXm());
                    map.put("xh", r.getXh());
                    map.put("bj", r.getBjmc());
                    map.put("zy", r.getZymc());
                    map.put("njmc", r.getNjmc());
                    if (r.getDrzw() == null || r.getDrzw().equals("")) {
                        map.put("drzw", null);
                    } else {
                        map.put("drzw", r.getDrzw());
                    }
                    if (r.getKsrq() == null) {
                        map.put("ksrq", null);
                    } else {
                        map.put("ksrq", sdf.format(r.getKsrq()));
                    }
                    map.put("rznx", r.getRznx());
                    map.put("creatorname", r.getCreatorname());
                    map.put("cjsj", sdf.format(r.getCreatetime()));
                    list.add(map);
                }
            }
            HSSFWorkbook wb = ExpExcelUtil.getWorkBookExcel(title_name, title_style, 100, remark,
                fileName, list);
            try {
                String filenameConvert = "学生干部管理信息";/* new String(fileName.getBytes("GB2312"), "ISO8859-1"); */
                response.reset();
                response.setContentType("application/vnd.ms-excel;charset=utf-8");
                response.setHeader("Content-Disposition",
                    "attachment;filename=" + new String((filenameConvert + ".xls").getBytes(),
                        "iso-8859-1"));
                response.setDateHeader("Expires", 0);
                ServletOutputStream os = response.getOutputStream();
                wb.write(os);
                os.flush();
            } catch (Exception e) {
                System.out.println("网络连接断开，可能用户取消了导出");
                model.addAttribute(Constant.EXPTION_MSG_KEY, e);
                return "error/error";
            }
        } catch (RPCException e) {
            LOGGER.error("获得信息 export[{}] error," + this.getClass().getName() + "=[{}]",
                this.getClass().getName(), e.getMessage());
            model.addAttribute(Constant.EXPTION_MSG_KEY, e);
            return "error/error";
        }
        return null;
    }

}
